import 'package:dmz/business/mine/controller/seting_repair_controller.dart';
import 'package:dmz/business/mine/widget/seting_repair_widgets.dart';

import 'package:flutter/material.dart';
import 'package:flutter/src/widgets/framework.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';

import '../../../base/pageWidget/base_stateful_widget.dart';
import '../../../base/widget/keep_alive_wrapper.dart';

class SetingRepairPage extends BaseStatefulWidget<SetingRepairController> {
  const SetingRepairPage({super.key});

  @override
  String titleString() => '报修单列表'.tr;

  @override
  List<Widget>? appBarActionWidget(BuildContext context) {
    return [
      Image.asset('assets/images/user/add_image.png',
              width: 88.sp, height: 88.sp)
          .addGestureDetector(() => controller.addNewRepair())
    ];
  }

  @override
  Widget buildContent(BuildContext context) {
    return Column(children: [
      Obx(() => SetRepairWidgets.repairTopWidget(
          controller.pageIndex.value, (index) => controller.changePage(index))),
      Expanded(
          child: KeepAliveWrapper(
              child: PageView(
                  controller: controller.pageController,
                  children: const [
            RepairListWidget(tag: 0),
            RepairListWidget(tag: 1),
            RepairListWidget(tag: 2),
            RepairListWidget(tag: 3),
          ])))
    ]);
  }
}
